# check erl meomory change
ERLPID=`pgrep -f 'beam'`; while [ 1 ] ; do MEM=`ps -o rss= -p $ERLPID`; echo -e "`date`\t`date +%s`\t$MEM\t"; sleep 60; done | tee -a spec_mem.log

# test for c external program memory leak
EXTPRGPID=`pgrep -f 'extprg'`; while [ 1 ] ; do MEM=`ps -o rss= -p $EXTPRGPID`; echo -e "`date`\t`date +%s`\t$MEM\t"; sleep 60; done | tee -a extprg_mem.log

#http://www.faqs.org/faqs/aix-faq/part2/section-15.html
#RSS - This tells how much RAM resident memory is currently being used
#for the text and data segments for a particular process in units of
#kilobytes.  (this value will always be a multiple of 4 since memory is
#allocated in 4 KB pages).

gcc -o extprg -I/usr/local/lib/erlang/lib/erl_interface-3.5.9/include/ -L/usr/local/lib/erlang/lib/erl_interface-3.5.9/lib/ spectrometer.c erl_comm.c spectrometer_ei.c -lerl_interface -lei -lpthread -lgdal
